/**
 *  interface 的使用
 *
 */

interface ClockConstructor {
    new(hour: number, minute: number): ClockInterface
}
interface ClockInterface {
    tick(): void;
}
class DingClock implements ClockInterface {
    tick(): void {
        console.log('ding ding ');

    }
}
class LingClock implements ClockInterface {
    tick(): void {
        console.log('ling lingling  ding ');
    }
}
function createClock(cst: ClockConstructor, hour: number, minute: number): ClockInterface {
    return new cst(hour, minute)
}

let clock1 = createClock(DingClock, 3, 4)
clock1.tick()
let clock2 = createClock(LingClock, 3, 4)
clock2.tick()